using System;
using MicroContainer;

namespace ConsoleDemo
{
   public delegate IMicroContainer ContainerFactoryMethodDelegate(IContainerBuilder builder);

   public static class ContainerConfig
   {
      [ContainerBuilder(true)]
      public static IMicroContainer CreateContainer(IContainerBuilder builder)
      {
         return builder
            .RegisterType(typeof(IComponentA), new FactoryMethodDelegate(ComponentA2.CreateComponentA2), "SomeName")
            .RegisterType(typeof(IComponentA), typeof(ComponentA1), null)
            .RegisterType(typeof(IComponentB), typeof(ComponentB), null)
            .RegisterType(typeof(IComponentC), typeof(ComponentC), "CompC", InstantiationMode.Singleton)
            .RegisterType(typeof(IMicroContainer), new ContainerFactoryMethodDelegate(CreateContainer))
            .Build();
      }      
   }
}
